package com.newlink.building.secret.mvp.model

import com.newlink.building.common_base.base.BaseModel
import com.newlink.building.common_base.http.Base_RetrofitHelper
import com.newlink.building.common_base.model.bean.*
import com.newlink.building.secret.mvp.contract.Module_Secret_SecretKeyAddContract
import io.reactivex.Observable

/**
 * Created by xiaodong on 2022/10/2.
 */
class Module_Secret_SecretKeyAddModel : BaseModel(), Module_Secret_SecretKeyAddContract.Model {

    override fun addSecretKey(requestBean: SecretKeyAddRequest): Observable<HttpResult<StatusData>> {
        return Base_RetrofitHelper.service.addSecretKey(
            requestBean.accessToken, SecretKeyAddData(
                requestBean.name,
                requestBean.prjType,
                requestBean.openNum,
                requestBean.repeatType,
                requestBean.effectTime,
                requestBean.period,
                requestBean.deviceMacs
            )
        )
    }

    override fun getDeviceList(
        requestBean: DeviceListRequest,
    ): Observable<HttpResult<DeviceListData>> {
        return Base_RetrofitHelper.service.getDeviceList(
            requestBean.accessToken,
            requestBean.page,
            requestBean.limit,
            requestBean.devName,
            requestBean.devType
        )
    }
}